﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace AdventureWorks.Client.WPF
{
    public partial class EmployeeSearch
    {
        partial void PostInitialize()
        {
            gridResults.MouseDoubleClick += OnMouseDoubleClick;
        }

        private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (gridResults.SelectedIndex >= 0)
            {
                int? id = list[gridResults.SelectedIndex].IdProperty.Value;
                if (id.HasValue) EmployeeDetails.Invoke(id.Value);
            }
        }
    }
}
